﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WSSaiGon
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                object[] param = new object[0];
                param = new object[] { TxtUsername3.Text, TxtPassword3.Text };
                object result = null;
                result = WebserviceInvoker
                                .WSInvoker
                                .CallWebService(txtLinkWS.Text, txtServiceName.Text, txtMethod.Text, param);
                if (lblResult0.Text != "")
                    lblResult0.Text = "Result: ";
                lblResult0.Text += "<br/>" + result.ToString();
            }
            catch
            {
                lblResult0.Text = "Please fill all fields, check all checkbox, and select correct data types";
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                object[] param = new object[0];
                param = new object[] { txtSID1.Text, 
                                        txtfromPositionID1.Text, 
                                        txt_toPositionID1.Text, 
                                        Convert.ToInt32(txt_itemsInformation1.Text), 
                                        txt_transportType1.Text, 
                                        Convert.ToDateTime(txt_beginGetItemTime1.Text), 
                                        txt_detail_FormPosition1.Text, 
                                        txt_detail_ToPosition1.Text };
                object result = null;
                result = WebserviceInvoker
                                .WSInvoker
                                .CallWebService(txtLinkWS.Text, txtServiceName.Text, txtMethod.Text, param);
                if (lblResult1.Text != "")
                    lblResult1.Text = "Result: ";
                lblResult1.Text += "<br/>" + result.ToString();
            }
            catch
            {
                lblResult1.Text = "Please fill all fields, check all checkbox, and select correct data types";
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                object[] param = new object[0];
                param = new object[] { TxtformPositionID2.Text,
                                        TxttoPositionID2.Text,
                                        Convert.ToInt32(TxtitemsInformation2.Text),
                                        TxttransportType2.Text};
                object result = null;
                result = WebserviceInvoker
                                .WSInvoker
                                .CallWebService(txtLinkWS.Text, txtServiceName.Text, txtMethod.Text, param);
                if (lblResult2.Text != "")
                    lblResult2.Text = "Result: ";
                lblResult2.Text += "<br/>" + result.ToString();
            }
            catch
            {
                lblResult2.Text = "Please fill all fields, check all checkbox, and select correct data types";
            }
        }
    }
}
